package com.itheima;

import com.fix.config.EnableUser;
import com.fix.config.MyImportSelector;
import com.fix.config.UserConfig;
import com.fix.pojo.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;

@SpringBootApplication
//@ComponentScan(basePackages = "com.fix")  //太重
//<componentScan  base>
//@Import(UserConfig.class)  //导入配置类
//@Import(User.class)  //导入对象
//@Import(MyImportSelector.class) //导入实现了ImportSelector的类
@EnableUser
public class SpringBoot05Application {
  /*
    springboot05默认扫描位置:package com.itheima;
    user Bean 创建包位置  com.fix
   */
	public static void main(String[] args) {
		ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringBoot05Application.class, args);
        //import导入配置类获取方式
        //Object user = applicationContext.getBean("user");
        //import导入对象获取方式  导入现实类ImportSelector的类
            Object user = applicationContext.getBean(User.class);
        System.out.println(user);

	}

}
